import Core.Gadget as Gadget
import datetime


DEFAULT_CAPITAL_BASE = 1000000

APPROX_BDAYS_PER_MONTH = 21
APPROX_BDAYS_PER_YEAR = 245 # 252

MONTHS_PER_YEAR = 12
WEEKS_PER_YEAR = 52

DAILY = 'daily'
WEEKLY = 'weekly'
MONTHLY = 'monthly'
YEARLY = 'yearly'

ANNUALIZATION_FACTORS = {
    DAILY: APPROX_BDAYS_PER_YEAR,
    WEEKLY: WEEKS_PER_YEAR,
    MONTHLY: MONTHS_PER_YEAR,
    YEARLY: 1
}

def normalize_date(dt):
    """
    Normalize datetime.datetime value to midnight. Returns datetime.date as
    a datetime.datetime at midnight

    Returns
    -------
    normalized : datetime.datetime or Timestamp
    """
    #return dt.normalize()

    dt_midnight = datetime.datetime(dt.year,dt.month,dt.day)
    dt_midnight += datetime.timedelta(hours=24)
    # dt_utc = Gadget.ToUTCDateTime(dt_midnight)
    return dt_midnight

